(function($, im, doc) {
	$.plusReady(function() {
		window.addEventListener('SENDMAP', function(event) {
			var data = event.detail;
			var content = 'http://api.map.baidu.com/staticimage/v2?ak=UtCm14GhAZi7cVMTKrj5DxxHjokiBMoX&width=238&height=168&zoom=14&markerStyles=s,A,0xff0000&markers=' + data.lng + ',' + data.lat;
			//console.log(content);
			var msg = {
				type: 'local',
				content: content,
				extras: {
					title: data.title,
					address: data.address,
					lng: data.lng,
					lat: data.lat
				}
			};
			im.sendMsg(msg, 0);
			im.playsendSound('local');
			im.closeFooterBox();
		});
		document.getElementById("mylocal").addEventListener('tap', function() {
			var service_comfirm = plus.webview.getWebviewById("location.html");
			service_comfirm && plus.webview.close(service_comfirm, "none");
			mui.openWindow({
				url: "location.html",
				id: "location.html"
			});
		});
		$("#msg-list").on('tap', '.map-area', function(e) {
			var title = this.getAttribute('data-title');
			var lng = this.getAttribute('data-lng');
			var lat = this.getAttribute('data-lat');
			var address = this.getAttribute('data-address');
			var service_comfirm = plus.webview.getWebviewById("mylocation.html");
			service_comfirm && plus.webview.close(service_comfirm, "none");
			mui.openWindow({
				url: "mylocation.html",
				id: "mylocation.html",
				extras: {
					title: title,
					address: address,
					lng: lng,
					lat: lat
				}
			});

		});
	});

}(mui, im, document));